package cn.itsource.ymcc.web.controller;

import cn.itsource.ymcc.result.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;
import java.util.concurrent.TimeUnit;

@RestController
public class TokenController {
    @Autowired
    private RedisTemplate<String,Object> redisTemplate;
    @GetMapping("/createToken")
    public JsonResult createToken(){
        String s = UUID.randomUUID().toString();
        redisTemplate.opsForValue().set(s,"",600, TimeUnit.SECONDS);
        return JsonResult.success().setData(s);
    }
}
